<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Mini Vue</title>
</head>
<body>
    <div id="app">
        <h1>差值表达式</h1>
        <h3>{{ message }}</h3>
        <h3>{{ age }}</h3>
        <h1>v-text</h1>
        <div v-text="message"></div>
        <h1>v-model</h1>
        <input type="text" v-model="message">
        <input type="text" v-model="age">
        <p>Using mustaches: {{ rawHtml }}</p>
        <p>Using v-html directive: <span v-html="rawHtml"></span></p>
        <button click="onClick" id="btn">原生 Click Me</button>
        <button v-on:click="onClick">Vue Click Me</button>
        <br>
        <input type="text" v-on:change="onChangeInput" v-on:keyup="onKeyup" placeholder="vue测试">
        <input type="text" id="input" placeholder="原生测试">
    </div>
    <script src="./js/dep.js"></script>
    <script src="./js/watcher.js"></script>
    <script src="./js/compiler.js"></script>
    <script src="./js/observer.js"></script>
    <script src="./js/vue.js"></script>
    <script>
        function onClick (e) {
            console.log('onClick',{e})
        }
        function onChangeInput (e) {
            console.log('onChangeInput',{e})
        }
        const btn = document.getElementById('btn')
        const input = document.getElementById('input')
        btn.onclick = onClick
        input.onchange = onChangeInput
        let vm = new Vue({
            el: '#app',
            data:{
                message: 'husky',
                age: 18,
                rawHtml: '',
                person:{
                    height: 158
                }
            },
            methods: {
                onClick(e){
                    console.log('onClick',{e})
                    vm.onText('click test')
                },
                onChangeInput(e){
                    console.log('onChangeInput',{e})
                },
                onKeyup(e){
                    console.log('onKeyup',{e})
                },
                onText(value){
                    console.log(`onText value:`, value)
                }
            },
        })
        console.log(vm.message)
        vm.rawHtml=` <strong style="color: red">this is strong red</strong>`
    </script>
</body>
</html>